package com.bjbn.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bjbn.entity.BridgeInfoHistory;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 廊桥_登机桥信息_历史模型Mapper接口
 */
@Mapper
public interface BridgeInfoHistoryMapper extends BaseMapper<BridgeInfoHistory> {
    
    /**
     * 统计总记录数
     */
    @Select("SELECT COUNT(*) FROM bridge_info_history")
    Long countTotal();
    
    /**
     * 根据设备名称查询
     */
    @Select("SELECT * FROM bridge_info_history WHERE DEVICE_NAME LIKE CONCAT('%', #{deviceName}, '%')")
    java.util.List<BridgeInfoHistory> findByDeviceNameContaining(String deviceName);
    
    /**
     * 分页查询廊桥历史信息
     */
    @Select("SELECT * FROM bridge_info_history LIMIT #{offset}, #{limit}")
    java.util.List<BridgeInfoHistory> selectPage(@Param("offset") int offset, @Param("limit") int limit);
    
    /**
     * 根据厂家查询
     */
    @Select("SELECT * FROM bridge_info_history WHERE BRAND = #{brand}")
    java.util.List<BridgeInfoHistory> findByBrand(String brand);
    
    /**
     * 根据区域查询
     */
    @Select("SELECT * FROM bridge_info_history WHERE AREA = #{area}")
    java.util.List<BridgeInfoHistory> findByArea(String area);
    
    /**
     * 根据设备组查询
     */
    @Select("SELECT * FROM bridge_info_history WHERE DEVICE_GROUP = #{deviceGroup}")
    java.util.List<BridgeInfoHistory> findByDeviceGroup(String deviceGroup);
    
    /**
     * 根据设备状态查询
     */
    @Select("SELECT * FROM bridge_info_history WHERE STA = #{sta}")
    java.util.List<BridgeInfoHistory> findBySta(String sta);
    
    /**
     * 根据IP地址查询
     */
    @Select("SELECT * FROM bridge_info_history WHERE IP = #{ip}")
    java.util.List<BridgeInfoHistory> findByIp(String ip);
    
    /**
     * 根据责任部门查询
     */
    @Select("SELECT * FROM bridge_info_history WHERE DEPT = #{dept}")
    java.util.List<BridgeInfoHistory> findByDept(String dept);
    
    /**
     * 根据时间范围查询
     */
    @Select("SELECT * FROM bridge_info_history WHERE BN_CREATE_TIME BETWEEN #{startTime} AND #{endTime}")
    java.util.List<BridgeInfoHistory> findByTimeRange(java.time.LocalDateTime startTime, java.time.LocalDateTime endTime);
}
